/*
    Copyright 2013 Jonathan Kaschak

    This file is part of TerraTamper.

    TerraTamper is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    TerraTamper is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with TerraTamper.  If not, see <http://www.gnu.org/licenses/>.
*/

package Main;

public class PlayerDatabase {
    static int board[][] = new int[256][23];
    
    static int pos_name_length = 0;
    static int pos_name = 1;
    static int pos_position_x = 21;
    static int pos_position_y = 22;
    
    private static void setNameLength(int PlayerID, int length){
        board[PlayerID][pos_name_length] = length;
    } private static int getNameLength(int PlayerID){
        return board[PlayerID][0];
    }
    
    public static void setName(int PlayerID, String Name){
        setNameLength(PlayerID, Name.length());
        for (int i = 0; i < Name.length(); i++) {
            board[PlayerID][pos_name+i] = Name.charAt(i);
        }
    } public static String getName(int PlayerID){
        String Name = "";
        for (int i = 0; i < getNameLength(PlayerID); i++) {
            Name += (char)board[PlayerID][pos_name+i];
        }
        return Name;
    }
    
    public static void setPositionX(int PlayerID, int x){
        board[PlayerID][pos_position_x] = x;
    } public static void setPositionY(int PlayerID, int y){
        board[PlayerID][pos_position_y] = y;
    } 
    public static int getPositionX(int PlayerID){
        return board[PlayerID][pos_position_x];
    } public static int getPositionY(int PlayerID){
        return board[PlayerID][pos_position_y];
    } 
}
